import axiosInstance from "@/tool/Myaxios";
export async function getCourse(name,credits){
    return (await axiosInstance.get('/admin/selectCourse', {params: {name: name, credits: credits}})).data;
}
export async function updateCourse(course){
    return (await axiosInstance.post('/admin/updateCourse', course)).data;
}
export async function dropCourse(course){
    return (await axiosInstance.post('/admin/deleteCourse', course)).data;
}
export async function insertCourse(course){
 return (await axiosInstance.post('/admin/addCourse', course)).data;
}
export async function getMajor(name) {
    return (await axiosInstance.get('/admin/selectMajor', { params: { name: name } })).data;
}

export async function updateMajor(major) {
    return (await axiosInstance.put('/admin/updateMajor', major)).data;
}

export async function dropMajor(id) {
    return (await axiosInstance.delete(`/admin/deleteMajor/${id}`)).data;
}

export async function insertMajor(major) {
    return (await axiosInstance.post('/admin/addMajor', major)).data;
}
//账号查询(分页)
export async function getAccount(queryCondition){
    return (await axiosInstance.post('/admin/selectAccount',queryCondition)).data
}
//账号修改
export async function updateAccount(account,isModifyingPassword){
    return (await axiosInstance.post(`/admin/updateAccount/${isModifyingPassword}`,account)).data
}
//账号添加
export async function insertAccount(account){
    return (await axiosInstance.post('/admin/addAccount',account)).data
}
//账号删除
export async function dropAccount(account){
    return (await axiosInstance.delete(`/admin/deleteAccount/${account}`)).data
}
//根据课程查询已选的学生（分页）or 根据学生查询已选的课程（分页）
export async function getSelectedStudent(queryCondition){
    return (await axiosInstance.post('/admin/selectCourseStudent',queryCondition)).data
}